

#include <QtGui>
#include "XML_Editor.h"
#include "SitamapLocalPath.h"
#include "DataBase_Session.h"





int main( int argc, char ** argv )
{
    QApplication a( argc, argv );
    DataBase_Session *sx = DataBase_Session::instance();
    
    XMLTextEdit w;
    w.show();
    
    Sitemap *sitemap = new Sitemap();
    PopoonLocalPath *map = new PopoonLocalPath("map.xml");
    map->moveToThread(sitemap);
    QObject::connect(sitemap, SIGNAL(finished()),map,SLOT(onclose()));
    QObject::connect(sitemap, SIGNAL(started()),map,SLOT(processing()));
    QObject::connect(map, SIGNAL(terminate()),sitemap, SLOT(deleteLater()));
    QObject::connect(map, SIGNAL(handle_msg(QString)),&w, SLOT(append(QString)));
    QObject::connect(sitemap, SIGNAL(destroyed(QObject*)),map,SLOT(onclose()));
    
    
    
    sitemap->start();
    
    
    a.connect(&a, SIGNAL(lastWindowClosed()), &a, SLOT(quit()));
    a.connect(&a, SIGNAL(lastWindowClosed()),sx, SLOT(close()));
    return a.exec();
}

